package settings.location;

import settings.logic.LocationService;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;


import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.os.IBinder;
import android.widget.Toast;


public class main extends MapActivity implements LocationListener {
    /** Called when the activity is first created. */
	private MapView map;
	private LocationService mBoundService;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        map=(MapView) findViewById(R.id.mapView);
        map.setBuiltInZoomControls(true);
        map.setKeepScreenOn(true);
        map.setAnimationCacheEnabled(true);
        map.setDrawingCacheQuality(map.DRAWING_CACHE_QUALITY_HIGH);
        Intent i = new Intent(this, 
                LocationService.class);
        bindService(i, mConnection, BIND_AUTO_CREATE);
        
    }

	@Override
	protected boolean isRouteDisplayed() {
		return false;
		
	}
	
	private ServiceConnection mConnection = new ServiceConnection() {
	    public void onServiceConnected(ComponentName className, IBinder service) {
	        // This is called when the connection with the service has been
	        // established, giving us the service object we can use to
	        // interact with the service.  Because we have bound to a explicit
	        // service that we know is running in our own process, we can
	        // cast its IBinder to a concrete class and directly access it.
	        mBoundService = ((LocationService.LocalBinder)service).getService();
	       
	        
	        
	        
	        

	        // Tell the user about this for our demo.
	        //Toast.makeText(Binding.this, R.string.local_service_connected,
	     //           Toast.LENGTH_SHORT).show();
	    }

	    public void onServiceDisconnected(ComponentName className) {
	        // This is called when the connection with the service has been
	        // unexpectedly disconnected -- that is, its process crashed.
	        // Because it is running in our same process, we should never
	        // see this happen.
	        mBoundService = null;
	        //Toast.makeText(Binding.this, R.string.local_service_disconnected,
	          //      Toast.LENGTH_SHORT).show();
	    }
	    
	};
	@Override
	public void onLocationChanged(Location location) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onProviderDisabled(String provider) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onProviderEnabled(String provider) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onStatusChanged(String provider, int status, Bundle extras) {
		// TODO Auto-generated method stub
		
	}

	
	
}